import Vue from 'vue'
import App from './App'
import router from './router'
import '@/assets/js/remChange'
import '@/assets/js/request'
import { wxConfig, updateShare } from '@/assets/js/wxenv'
import '@/assets/css/common.scss'
import config from '@/assets/js/config'
// import Es6Promise from 'es6-promise'
// Es6Promise.polyfill()

Vue.config.productionTip = false
Vue.prototype.$config = config
// 路由切换时改变页面标题
router.beforeEach(function (to, from, next) {
  document.querySelector('title').innerHTML = to.name
  next()
})

// 路由变化重新配置分享
router.afterEach(function (to) {
  wxConfig(() => {
    updateShare()
  })
})

/* eslint-disable no-new */
const app = new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})
